import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        /**
         * 是否需要强制登录
         */
        forcedLogin: false,
        hasLogin: false,
        userName: "",
		
		loginUrl:"http://59.110.234.118:9000/",
		// loginUrl:"http://39.104.168.208:9000/",
		// loginUrl:"http://192.168.1.70:9000/",
		userInfo:{
			uid:'',
			point:0,
			avator:'',
			address:'',
			tel:'',
			level:0
		},
		evaluateID:-1
    },
    mutations: {
        login(state, userName) {
            state.userName = userName || '新用户';
            state.hasLogin = true;
        },
        logout(state) {
            state.userName = "";
            state.hasLogin = false;
        },
		setUid(state, uid){
			state.userInfo.uid = uid;
		},
		setPoint(state, point){
			state.userInfo.point = point;
		},
		setInfo(state, tel){
			state.userInfo.tel = tel;
		},
		setLevel(state,level){
			state.userInfo.level = level;
		},
		setAvator(state, img){
			state.userInfo.avator = img;
			state.userInfo.headurl = img;
		},
		setName(state, name){
			state.userInfo.name = name;
		},
		setAddress(state, address){
			state.userInfo.address = address;
		},
		setevaluateID(state, id){
			state.evaluateID = id;
		},
    }
})

export default store
